<?php
namespace api\know\controller;

use api\know\model\HbvFightRecordModel;
use api\know\controller\KnowRestUserController;

class HbvFightRecordController extends KnowRestUserController
{
    public function lst()
    {
		$uid = $this->getUserId('uid');
		$pageNumber = $this->request->param('pageNumber', 1, 'intval');
		$pageSize = $this->request->param('pageSize', 10, 'intval');
        
		$w = ['uid' => $uid, 'is_delete' => 0];
		
        $rows = HbvFightRecordModel::where($w)
			->page($pageNumber, $pageSize)
			->order('create_datetime desc')
			->select();

        $this->success('请求成功!', $rows);
    }

    public function add()
    {
        $uid = $this->getUserId('uid');
		$r = [ 'uid' => $uid ];
		HbvFightRecordModel::create($r);
        $this->success('请求成功!');
    }
	
	public function del()
    {
        $id = $this->request->param('id', 0, 'intval');
		$w = [ 'id' => $id ];
		
		HbvFightRecordModel::update(['is_delete' => 1], $w);
        $this->success('请求成功!');
    }



}
